<form class="layui-form" lay-filter="form" id="form">
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" lay-verify="required" lay-reqText="标题不能为空" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">缩略图</label>
        <div class="layui-input-inline">
            <input type="text" name="image" autocomplete="off" class="layui-input plupload_btn_input">
        </div>
        <div class="layui-input-inline">
            <script type="text/html" template>
                <a href="{{ d.params.image || '' }}" target="_blank">
                    <img src="{{ d.params.image || '' }}" width="35" class="{{ d.params.image || 'layui-hide' }}">
                </a>
            </script>
            <button type="button" class="layui-btn layui-btn-sm plupload_btn" id="image"><i class="layui-icon sm_iconfont icon-yunshangchuan"></i>选择图片</button>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label label-required-next">请选择分类</label>
        <div class="layui-input-block">
            <script type="text/html" template lay-url="{{ layui.setter.apiHost }}/tool/category/select_all" lay-done="layui.form.render();">
                <select name="category_id" lay-search="" lay-verify="required" lay-reqText="请选择分类">
                    <option value=""></option>
                    {{# layui.each(d.data, function(index, item){ }}
                    <option value="{{ item.id }}" {{# if(item.children){ }}disabled{{# } }}{{# if(item.id== d.params.category_id){ }}selected{{# } }}>{{ item.title }}</option>
                    {{# if(item.children){ }}
                    {{# layui.each(item.children, function(index1, item1){ }}
                    <option value="{{ item1.id }}" {{# if(item1.children){ }}disabled{{# } }}{{# if(item1.id== d.params.category_id){ }}selected{{# } }}>|--{{ item1.title }}</option>
                    {{# }); }}
                    {{# } }}
                    {{# }); }}
                </select>
            </script>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">详情</label>
        <div class="layui-input-block">
            <div class="editor">
                <div id="toolbar_editor_content" class="toolbar"></div>
                <div id="editor_content" class="content"></div>
            </div>
            <textarea name="content" id="content" class="layui-hide"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="hidden" name="id" value="">
            <input type="button" lay-submit lay-filter="form-submit" value="确认" class="layui-btn">
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/html" template lay-done="layui.data.sendParams(d.params);"></script>
<script src="../../../../layuiadmin/lib/plupload/plupload.full.min.js"></script>
<script src="../../../../layuiadmin/lib/plupload/i18n/zh_CN.js"></script>
<script src="../../../../layuiadmin/lib/wangeditor/index.js"></script>
<link href="../../../../layuiadmin/lib/wangeditor/style.css" rel="stylesheet">
<script src="../../../../layuiadmin/lib/aliyun-oss-sdk.min.js"></script>
<script>
    layui.data.sendParams = function (params) {
        layui.use(['plupload', 'editor'], function () {
            let $ = layui.$,
                plupload = layui.plupload,
                editor = layui.editor;
            plupload.init();//初始化上传
            editor.init(params.content);//初始化编辑器
        });
    }
</script>